<template>
	<view :class="['main_style','main_bg']">
		<block v-for="(item,index) in list" :key="index">
			<view class="item_class" @click="clickItem(item)">{{item.title}}</view>
		</block>
		<u-popup ref="popup" mode="center" border-radius="10">
			<authUser :callback="callback"></authUser>
		</u-popup>
	</view>
</template>

<script>
	import authUser from '@/pages/mine/scope/userInfo_main.vue'
	var _this = null;
	export default {
		components:{authUser},
		data() {
			return {
				userInfo:null,
				list:[{
					'title':'二维码管理',
					'type':'managerQr'
				},{
					'title':'更新用户信息',
					'type':'update'
				}]
			}
		},
		onLoad() {
			_this = this;
		},
		methods: {
			callback(p) {
				if (p === '1') {
					
					_this.userInfo = uni.getStorageSync('userInfo');
				}
				_this.$refs.popup.close();
			},
			onShows() {
				
				this.userInfo = uni.getStorageSync('userInfo');
				console.log(JSON.stringify(this.userInfo));
				// if (this.$u.test.isEmpty(this.userInfo.user_portrait)) {
					this.$refs.popup.open();
				// }
			},
			clickItem(item){
				if(item.type == 'managerQr'){
					uni.navigateTo({
						url:'/pages/admin/main'
					})
				}else if(item.type == 'update'){
					this.onShows();
				}
			}
		}
	}
</script>

<style lang="stylus" scoped>
	.main_bg{
		background-color #eee;
	}
	
	.item_class{
		padding 20rpx
		display flex;
		// margin-bottom 20rpx;
		margin-top 20rpx;
		margin-left 20rpx;
		margin-right 20rpx;
		height 130rpx;
		background-color #fff;
		border-radius 10rpx;
		justify-content space-between;
		align-items center;
	}
</style>
